package test.com.sms.selenium.singlepoint.util;

import org.openqa.selenium.By;

import test.com.sms.selenium.framework.SeleniumPageUtil;
import test.com.sms.selenium.util.SeleniumUtil;

public class SpIncidentEditSLTabPageUtil extends SeleniumPageUtil {
	public final static By IES_TD_SLA_NAME = By.xpath("//*[@id='pnlPage']/table/tbody/tr/td/div[5]/div[1]/table/tbody/tr[1]/td[1]");
	public final static By IES_INPUT_SLA_NAME = By.id("SLATermsEdit1_txtSLATermName");
	public final static By IES_TD_DESC = By.xpath("//*[@id='pnlPage']/table/tbody/tr/td/div[5]/div[1]/table/tbody/tr[2]/td[1]");
	public final static By IES_IINPUT_DESC = By.id("SLATermsEdit1_txtDescription");
	public final static By IES_TD_VERBOSE = By.xpath("//*[@id='pnlPage']/table/tbody/tr/td/div[5]/div[1]/table/tbody/tr[3]/td[1]");
	public final static By IES_TEXTAREA_VERBOSE = By.id("SLATermsEdit1_txtVerbose");
	
	public final static By IES_TD_COVER = By.xpath("//*[@id='pnlPage']/table/tbody/tr/td/div[5]/div[2]/table/tbody/tr[1]/td/span");
	public final static By IES_CHECKBOX_COVER = By.id("SLATermsEdit1_chkCover_247Flag");
	public final static By IES_TD_COVER_DAYS = By.xpath("//*[@id='pnlPage']/table/tbody/tr/td/div[5]/div[2]/table/tbody/tr[2]/td[1]");
	public final static By IES_CHECKBOX_SUN = By.id("SLATermsEdit1_chkSunFlag");
	public final static By IES_SPAN_SUN = By.xpath("//*[@id='pnlPage']/table/tbody/tr/td/div[5]/div[2]/table/tbody/tr[2]/td[2]/table/tbody/tr/td[1]");
	public final static By IES_CHECKBOX_MON = By.id("SLATermsEdit1_chkMonFlag");
	public final static By IES_SPAN_MON = By.xpath("//*[@id='pnlPage']/table/tbody/tr/td/div[5]/div[2]/table/tbody/tr[2]/td[2]/table/tbody/tr/td[2]");
	public final static By IES_CHECKBOX_TUE = By.id("SLATermsEdit1_chkTueFlag");
	public final static By IES_SPAN_TUE = By.xpath("//*[@id='pnlPage']/table/tbody/tr/td/div[5]/div[2]/table/tbody/tr[2]/td[2]/table/tbody/tr/td[3]");
	public final static By IES_CHECKBOX_WED = By.id("SLATermsEdit1_chkWedFlag");
	public final static By IES_SPAN_WED = By.xpath("//*[@id='pnlPage']/table/tbody/tr/td/div[5]/div[2]/table/tbody/tr[2]/td[2]/table/tbody/tr/td[4]");
	public final static By IES_CHECKBOX_THU = By.id("SLATermsEdit1_chkThuFlag");
	public final static By IES_SPAN_THU = By.xpath("//*[@id='pnlPage']/table/tbody/tr/td/div[5]/div[2]/table/tbody/tr[2]/td[2]/table/tbody/tr/td[5]");
	public final static By IES_CHECKBOX_FRI = By.id("SLATermsEdit1_chkFriFlag");
	public final static By IES_SPAN_FRI = By.xpath("//*[@id='pnlPage']/table/tbody/tr/td/div[5]/div[2]/table/tbody/tr[2]/td[2]/table/tbody/tr/td[6]");
	public final static By IES_CHECKBOX_SAT = By.id("SLATermsEdit1_chkSatFlag");
	public final static By IES_SPAN_SAT = By.xpath("//*[@id='pnlPage']/table/tbody/tr/td/div[5]/div[2]/table/tbody/tr[2]/td[2]/table/tbody/tr/td[7]");
	public final static By IES_TD_HOURS_START = By.xpath("//*[@id='pnlPage']/table/tbody/tr/td/div[5]/div[2]/table/tbody/tr[3]/td[1]");
	public final static By IES_INPUT_HOURS_START = By.id("SLATermsEdit1_txtHoursStart");
	public final static By IES_TD_HOURS_END = By.xpath("//*[@id='pnlPage']/table/tbody/tr/td/div[5]/div[2]/table/tbody/tr[4]/td[1]");
	public final static By IES_INPUT_HOURS_END = By.id("SLATermsEdit1_txtHoursEnd");
	public final static By IES_TD_NBD = By.xpath("//*[@id='pnlPage']/table/tbody/tr/td/div[5]/div[2]/table/tbody/tr[5]/td[1]");
	public final static By IES_CHECKBOX_NBD = By.id("SLATermsEdit1_chkNextBizDayFlag");
	public final static By IES_TD_ORH = By.xpath("//*[@id='pnlPage']/table/tbody/tr/td/div[5]/div[2]/table/tbody/tr[6]/td[1]");
	public final static By IES_INPUT_ORH = By.id("SLATermsEdit1_txtOnSiteResponse");
	public final static By IES_TD_RCH = By.xpath("//*[@id='pnlPage']/table/tbody/tr/td/div[5]/div[2]/table/tbody/tr[7]/td[1]");
	public final static By IES_INPUT_RCH = By.id("SLATermsEdit1_txtReturnCallTime");
	public final static By IES_TD_ETH = By.xpath("//*[@id='pnlPage']/table/tbody/tr/td/div[5]/div[2]/table/tbody/tr[8]/td[1]");
	public final static By IES_INPUT_ETH = By.id("SLATermsEdit1_txtEscalationTime");
	
	public static void enterSLTab(String incidentId){
		// login into homepage
		SpSearchPageUtil.enter();
		// current window handle
		// make sure search button and incident id input text show
		SeleniumUtil.assertTrue(SeleniumUtil.isDisplayed(SeleniumUtil.getCachedElement(SpIncidentEditPageUtil.IE_BUTTON_SEARCH)));
		SeleniumUtil.assertTrue(SeleniumUtil.isDisplayed(SeleniumUtil.getCachedElement(SpIncidentEditPageUtil.IE_MAIN_INPUT_INCIDENT_ID)));
		// click the incident id link to enter the edit page
		SpIncidentEditPageUtil.enterIncidentID(incidentId);
		//click Assets link to enter incident/Asset edit page
		SeleniumUtil.click(SeleniumUtil.getCachedElement(SpIncidentEditPageUtil.IE_LINK_TAB_SERVICE_LEVEL));
		waitForPageToLoad();
	}
	public static void waitForPageToLoad(){
		SeleniumUtil.selectDefaultContent();
		SeleniumUtil.waitOnElements(new By[]{
				IES_TD_SLA_NAME,IES_INPUT_ETH
		});
	}
}
